package cn.icast.netty.c4;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.Array;


@Slf4j
public class writeBuf {
    public static void main(String[] args) {
        ByteBuf buf = ByteBufAllocator.DEFAULT.buffer();
        buf.writeBytes(new byte[]{1, 2, 3, 4});
        buf.readByte();

        buf.markReaderIndex();  //做一个标记
        log.debug("{}", buf.readByte());
        ByteBuf buf1 = buf.resetReaderIndex();//复读标记
        log.debug("second{}", buf1.readByte());

    }
}
